package com.example.bodycontrolmoduledomain

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow

suspend fun <T> Flow<T>.compareWithPrevious():Flow<Pair<T?,T>>{
    var previousValue:T? = null

    return flow {
        collect{value->
            val comparePair = Pair(previousValue,value)
            emit(comparePair)
            previousValue = value
        }
    }
}